
package InterfaceStaff;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class MenuUtama extends JFrame implements ActionListener {

    private static final int Lebar = 400;
    private static final int Tinggi = 200;
    private static final int x = 0;
    private static final int y = 0;
    private JButton rekap, buat, exit;
    Container contentPane;
    private ImageIcon exiticon = new ImageIcon("Icon/exit.jpg");
    private ImageIcon create = new ImageIcon("Icon/createa.jpg");
    private ImageIcon rekapicon = new ImageIcon("Icon/rekap.jpg");

    public MenuUtama() {
        setSize(Lebar, Tinggi);
        setTitle("Menu Admin Presensi");
        setLocation(x, y);
        setResizable(true);

        contentPane = getContentPane();
        contentPane.setLayout(new GridLayout(1, 3));

        buat = new JButton("Buat Presensi");
        buat.setToolTipText("Buat Presensi");
        buat.setIcon(create);
        buat.setBackground(Color.white);
        this.add(buat);
        buat.addActionListener(this);

        rekap = new JButton("Rekap");
        rekap.setToolTipText("Rekap");
        rekap.setIcon(rekapicon);
        rekap.setBackground(Color.GRAY);
        this.add(rekap);
        rekap.addActionListener(this);

        exit = new JButton("Exit");
        exit.setToolTipText("Exit");
        exit.setIcon(exiticon);
        exit.setBackground(Color.white);
        this.add(exit);
        exit.addActionListener(this);

        setDefaultCloseOperation(EXIT_ON_CLOSE);
    }

    public static void main(String[] args) {
        MenuUtama frame = new MenuUtama();
        frame.setVisible(true);
    }
//    private void JButtonActionPerformed(java.awt.event.ActionEvent evt){
//        JOptionPane.showMessageDialog(this, "Terimakasih");
//        System.exit(0);
//    }
    public void actionPerformed(ActionEvent e) {
        String button;
        button = e.getActionCommand();

        if (button.equals("Buat Presensi")) {
            FormPresensi f = new FormPresensi();
            f.setVisible(true);}
          if (button.equals("Rekap")){
                Rekap r = new Rekap();
                r.setVisible(true);
            
        } else if (button.equals("Exit")) {
              dispose();
        }
    }
}

 